<template>
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal"
             @select="handleSelect" router>
      <div class="logo-container" @click="logoClick">
        <span class="iconfont logo">&#xe6bf; WeCode</span>
      </div>
      <el-menu-item index="/home">题集</el-menu-item>
      <el-menu-item index="/submitRecord">提交记录</el-menu-item>
      <el-menu-item index="/about">关于</el-menu-item>
<!--      <el-menu-item index="12">处理中心</el-menu-item>-->
<!--      <el-submenu index="2">-->
<!--        <template #title>我的工作台</template>-->
<!--        <el-menu-item index="2-1">选项1</el-menu-item>-->
<!--        <el-menu-item index="2-2">选项2</el-menu-item>-->
<!--        <el-menu-item index="2-3">选项3</el-menu-item>-->
<!--        <el-submenu index="2-4">-->
<!--          <template #title>选项4</template>-->
<!--          <el-menu-item index="2-4-1">选项1</el-menu-item>-->
<!--          <el-menu-item index="2-4-2">选项2</el-menu-item>-->
<!--          <el-menu-item index="2-4-3">选项3</el-menu-item>-->
<!--        </el-submenu>-->
<!--      </el-submenu>-->
<!--      <el-menu-item index="3" disabled>消息中心</el-menu-item>-->
<!--      <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>-->
    </el-menu>
<!--    <div class="line"></div>-->
</template>

<script>
export default {
  name: "NavBar",
  data() {
    return {
      activeIndex: '/home',
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      // console.log(key, keyPath);
    },
    logoClick() {
      if(this.$route.path !== "/") {
        this.$router.push("/");
      }
    }
  }
}
</script>

<style scoped>
  .logo-container {
    font-family: "Microsoft YaHei",serif;
    font-weight: bold;
    float: left;
    height: 60px;
    line-height: 60px;
    padding: 0 20px;
    cursor: pointer;
  }

  .logo {
    font-size: 24px;
    padding: 0 8px;
  }

  .el-menu {
    padding: 0 100px;
  }
</style>